const mysql = require('mysql')
const connection = mysql.createConnection({
  host:'localhost',
  user: 'root',
  password:'root',
  port:'3306',
  database: 'myblog'
})
connection.connect()
const sql = 'select * from blogs'
connection.query(sql,(err,result)=>{
  if (err){
    console.error(err)
    return
  }
  console.log(result)
})
connection.end()